package open.tech.dawn.web.core.service;

import open.tech.dawn.web.core.entity.AuthEntity;
import open.tech.dawn.web.core.entity.LoginUser;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public interface IAuthService {
    /**
     * 获取当前用户
     *
     * @return 返回
     */
    LoginUser getUser();


    /**
     * 更新token
     * @return 返回
     */
    AuthEntity updateToken();


    /**
     * 通过用户构建权限码
     *
     * @param loginUser 登录用户
     * @return 返回
     */
    AuthEntity build(LoginUser loginUser);

    /**
     * 用户密码登录
     *
     * @param request 请求
     * @param response 响应
     * @return 返回
     */
    AuthEntity login(HttpServletRequest request, HttpServletResponse response);


    void logout(LoginUser loginUser, HttpServletRequest request, HttpServletResponse response);


}
